* formal_ebite_sens_graph.do	

*************************** Change log ********************************** 

/*
	
*/	

clear 
version 13.1

* Project info
cap project, doinfo
if _rc==198 {
	loc pr=0
	if c(username)=="J16339" loc master "B:\Col_Minimum_Wage" 
	else if c(username)=="A15858" loc master "B:\Col_Minimum_Wage"
	else if c(os)=="Windows" loc master "C:/Users/jorpp/Dropbox (Brown)/Col_Minimum_Wage"
	else loc master "/home/jperez/AA_Minimum_Wage"
}
else {
	loc pr=1
	local master "`r(pdir)'"
	local doname "`r(dofile)'" 
	* Project calls
	project, relies_on("`master'/Code/Est/rifregtable2.do")
	project, relies_on("`master'/Code/Est/graph_multirif.do")
	foreach x in 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 {
		forv i=1(1)7 {
			* There's some issue with the registration of these files but I can't stop here. Will fix later.
			* project, uses("`master'/Ster/rif10_new_ebite_indcc/rob/reg_emp_bp_tq(1999q1)_ebite_salario_mensual_real_50_edom_indcc_`i'_p`x'.ster")
		}
	}
}

cap program drop mex
program define mex
	cap mkdir "`2'/Doc"
	cap mkdir "`2'/Doc/tosubmit2"
	cap mkdir "`2'/Doc/tosubmit2/fig"
	graph export "`2'/Doc/tosubmit2/fig/`1'.pdf", replace
	graph export "`2'/Doc/tosubmit2/fig/`1'.png", replace
	graph export "`2'/Doc/tosubmit2/ILR-Figs/FigB5_b_`1'.png", replace
	*! epstopdf "`2'/Doc/tosubmit/fig/`1'.eps"
	*erase "`2'/Doc/tosubmit/fig/`1'.eps"
	* project, creates("`2'/Doc/tosubmit2/fig/`1'.pdf")
end	

do "`master'/Code/Est/graph_multirif.do"

* Specs to get all the graphs

glo folders ""
glo specs ""
glo bites ""
glo subs ""
glo times ""
glo patterns ""

forv i=1(1)7 {
	glo folders "${folders} rif10_new_ebite_indcc/rob"
	glo specs "${specs} reg_emp_bp"
	glo bites "${bites} ebite"
	glo subs "${subs} `i'"
	glo times "${times} tq(1999q1)"
	if `i'==5 glo patterns "${patterns} solid"
	else glo patterns "${patterns} dot"
}

graph drop _all
glo qtiles "5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90"
set scheme s1color
graphmultirif, master("`master'") ster(Ster) folders(${folders}) qtiles($qtiles) specs(${specs}) bites(${bites}) subs(${subs}) times(${times}) axes(1 1) twowayopts( legend(label(5 "0.9-1.1 minimum wages") label(2 "Others in the range 0.8-1.2 minimum wages") order(5 2) rows(2))  xtitle(Percentile) ytitle(Coefficient) yscale(range(-0.0015 0.0040)) xscale(range(5 90)) xlab(10(10)90) ylabel(-0.0015(0.0005)0.0040, angle(horizontal)), (pci -0.0015 52 0.0040 52, lcolor(black)) (pci -0.0015 62 0.0040 62, lcolor(cranberry) lpattern(dash))) patterns(${patterns})

* Had to add text by hand
graph play "`master'/Code/Doc/tosubmit2/informal_ebite_sens_edit.grec"

mex informal_ebite_sens "`master'"

if `pr' project, creates("`master'/Doc/tosubmit2/fig/informal_ebite_sens.pdf")
